Repository navigation
fix(webapp): keep presentation when another screen share stops - #62
Merged
Merged
Conversation
The presentation slot was a single global stream pushed and cleared by each player's watcher. When a second participant started and then stopped sharing, their player cleared the slot while the first participant was still sharing, and no watcher fired to restore it — the presentation disappeared for everyone until the surviving sharer touched a device (#47). Derive the slot from a registry instead: streams register while their screen flag is set and unregister on stop/unmount; the newest registrant takes the stage and earlier ones resume when it leaves. Re-registering an existing id keeps its position so media refreshes never steal the stage. Adds a two-browser regression test that stops the second share and asserts the first presentation is still playing on both sides. Fixes #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (#47)
The shared screen is lost occasionally, with no stable repro. The captured scene: the sharer's browser is still capturing ("is sharing your screen"), both sides are connected, yet the presentation has vanished entirely.
Root cause
presentationStreamwas a single global slot, imperatively pushed and cleared by each player component's watcher. Repro sequence:Overlapping shares are a necessary condition, hence rare and hard to repro. (The July 2025 version keyed the slot by display name, so a same-named or unnamed participant joining/leaving could clear someone else's presentation — even more fragile. After the React→Vue rewrite only the last-writer-wins class remained.)
Fix
Derive "who is sharing" instead of pushing/clearing imperatively (
webapp/store/atoms.ts):presentationCandidates: a registry keyed by streamId (Map, insertion order)presentationStreambecomes a computed — the "clear" operation no longer existsPlayer components (whip/whep) only register/unregister themselves and never write the global slot.
Verification
Fixes #47